package lab02.Test21;

import java.util.Scanner;

/**
 * Created by Administrator on 2017/10/30.
 */
public class Test21 {
    public static void main(String[] args) {
        System.out.println("请输入你的字符串：");
        Scanner sc =new Scanner(System.in);
        String string = sc.nextLine();
        System.out.println("请输入你想统计的字符频率：");
        Scanner ch = new Scanner(System.in);
        String  target = ch.next();
        String [] result = string.split("");
        frequency(result,target);
    }
    public static void  frequency(String[] result,String ch){
        int count=0;
        for(int i=0;i<=result.length-1;i++){
           if(ch.equals(result[i])){
               count++;
           }
       }
        System.out.println(ch+"频率是："+count+"/"+result.length);
    }
}
